
    <link rel="stylesheet" href="/js/intlTelInput/css/intlTelInput.css">
    <script src="/js/intlTelInput/js/intlTelInput.js"></script>
    <div class="login">
        <h1>登录</h1>
        <form id="loginForm" action="" method="post">
            <div class="form-group">
                <p>您的手机号</p>
                <div class="input-group ismobile">
                    <input type="text" id="login_mobles" class="texts" style="display: none;">
                    <input id="login_moble" name="moble" type="tel" class="fromInt mobile_int" maxlength="11" placeholder="请输入您的手机号">
                </div>
            </div>
            <div class="form-group">
                <p>密码</p>
                <div class="input-group"><input id="login_password" name="password" type="password" class="fromInt" placeholder="请输入您的密码"></div>
            </div>
            <div class="form-group">
                <p>验证码</p>
                <div class="input-group"><input id="login_verify" name="verify" type="tel" class="fromInt" maxlength="6" placeholder="请输入验证码"></div>
                <img style="padding: 0;" onclick="login_verify_ups(this)" id="login_verify_up" class="code" src="/verify.html"/>
            </div>
            <button type="button" onclick="footer_login()">登录</button>
        </form>
        <footer>
            <p><a href="/register.html">免费注册</a>&nbsp;&nbsp;|&nbsp;&nbsp;<a href="javascript:alert('请联系客服')">忘记密码？</a></p>
        </footer>
    </div>
    <script>
        $("#login_mobles").intlTelInput({
            autoHideDialCode: false,
            defaultCountry: "cn",
            nationalMode: false,
            preferredCountries: ['cn', 'us', 'hk', 'tw', 'mo']
        });

        $(document).keypress(function(e) {
            if(e.which == 13) {
                footer_login();
            }
        });

        function footer_login() {
            var moble    = $("#login_moble").val();
            var mobles   = $("#login_mobles").val();
            var password = $("#login_password").val();
            var verify   = $("#login_verify").val();

            if (moble == "" || moble == null) {
                layer.tips('请输入手机号', '#login_moble', {tips: 2});
                return false;
            }
            if (password == "" || password == null) {
                layer.tips('请输入登录密码', '#login_password', {tips: 2});
                return false;
            }
            if (verify == "" || verify == null) {
                layer.tips('请输入验证码', '#login_verify', {tips: 2});
                return false;
            }

            layer.load(2);
            $.post("/login.html", {
                moble: moble,
                mobles: mobles,
                password: password,
                verify: verify
            }, function (data) {
                layer.closeAll('loading');
                if (data.errCode == 0) {
                    layer.msg(data.errMsg, {icon: 1, offset: ['500px', '875px']});
                    go_index();
                } else {
                    $("#login_verify_up").click();
                    layer.msg(data.errMsg, {icon: 2, offset: ['500px', '875px']});
                }
            }, "json");
            return false;
        }

        function go_index() {
            window.location = '/buy/btc.html';
        }

        function login_verify_ups(obj) {
            $(obj).attr('src', "/verify.html?t=" + Math.random());
        }
    </script>
